package models

import "go.didapinche.com/time"

const ApiDataTableName = "t_api_data"

type ApiData struct {
	//表字段
	ID                uint64    `gorm:"primary_key,column:id" json:"id" form:"id"`
	AppID             uint64    `gorm:"column:app_id" json:"app_id" form:"app_id"`
	ApiID             uint64    `gorm:"column:api_id" json:"api_id" form:"api_id"`
	Date              string    `gorm:"column:date" json:"date" form:"date"`
	AppName           string    `gorm:"column:app_name" json:"app_name" form:"app_name"`
	HttpMethod        string    `gorm:"column:http_method" json:"http_method,omitempty" form:"http_method"`
	HttpPath          string    `gorm:"column:http_path" json:"http_path,omitempty" form:"http_path"`
	ZeusMethod        string    `gorm:"column:zeus_method" json:"zeus_method,omitempty" form:"zeus_method"`
	ZeusService       string    `gorm:"column:zeus_service" json:"zeus_service,omitempty" form:"zeus_service"`
	Level             int       `gorm:"column:level" json:"level" form:"level"`
	DevGroupID        string    `gorm:"column:dev_group_id" json:"dev_group_id,omitempty" form:"dev_group_id"`
	DevGroupName      string    `gorm:"column:dev_group_name" json:"dev_group_name,omitempty" form:"dev_group_name"`
	ErrorCount        float64   `gorm:"column:error_count" json:"error_count" form:"error_count"`
	ClientErrorCount  float64   `gorm:"column:client_error_count" json:"client_error_count" form:"client_error_count"`
	TotalRequestCount float64   `gorm:"column:total_request_count" json:"total_request_count" form:"total_request_count"`
	TP99              float64   `gorm:"column:tp99" json:"tp99" form:"tp99"`
	TP95              float64   `gorm:"column:tp95" json:"tp95" form:"tp95"`
	QPS               float64   `gorm:"column:qps" json:"qps" form:"qps"`
	CreateTime        time.Time `gorm:"column:create_time" json:"create_time" form:"create_time"`
	Owner             string    `gorm:"column:owner" json:"owner" form:"owner"`
	Type              int       `gorm:"type" json:"type" form:"type"` //0:http 1:zeusserver暂时没有zeus客户端
	Value             float64   `json:"-" gorm:"-"`
	Sla               string    `json:"sla" gorm:"-"`
	Users             []string  `gorm:"-" json:"users" form:"users"`
	Method            string    `gorm:"-" json:"method" form:"method"`
}

func (ApiData) TableName() string {
	return ApiDataTableName
}
